<?php
namespace Lib\ORG;
class FileLogic {
    
    
    public function __construct() {
    }
    
    private function __set($property_name, $value) {
        $this->$property_name = $value; 
    }
    
    private function __get($property_name){
        if(isset($this->$property_name))
        {
            return($this->$property_name);
        }
        else
        {
            return(NULL);
        }
    }
    
    

    public function createFolder($userID,$folderPname,$foldername){
        $dirPName = C('UPLOAD_ALLSHOP_PATH') . 'userID_'.$userID;
        
        
        $dirName = $folderPname.DS.$foldername;
    
        $dirName = str_replace("\\", "/", $dirName);
    
        $dirName = explode('/', $dirName);
    
        array_unshift($dirName, $dirPName);
        foreach ($dirName as $key=>$dir){
            if ($key == 0){
                $dirTree = $dir;
                if (!is_dir($dir)){
                    mkdir($dir);
                }
            } else{
                $dirTree = $dirTree.DS.$dir;
                if (!is_dir($dirTree)){
                    mkdir($dirTree);
                }
            }
        }
    
    }
    
}
